﻿namespace Vdc.Grid
{
    using System;
    using System.ComponentModel;
    using System.Web.UI;

    [ParseChildren(true), PersistChildren(false)]
    public class CheckBoxSelectColumn : Column, ICloneable
    {
        public CheckBoxSelectColumn()
        {
            base.Width = "60";
        }

        public object Clone()
        {
            return new CheckBoxSelectColumn { 
                Align = base.Align, AllowDelete = base.AllowDelete, AllowEdit = base.AllowEdit, AllowFilter = base.AllowFilter, AllowGroupBy = base.AllowGroupBy, AllowSorting = base.AllowSorting, ApplyFormatInEditMode = this.ApplyFormatInEditMode, ControlType = this.ControlType, DataField = this.DataField, DataFormatString = this.DataFormatString, DataFormatString_GroupHeader = base.DataFormatString_GroupHeader, ExportAsText = base.ExportAsText, GroupBy = base.GroupBy, GroupByPriority = base.GroupByPriority, HeaderAlign = base.HeaderAlign, HeaderText = this.HeaderText, 
                HtmlEncode = this.HtmlEncode, Index = base.Index, ParseHTML = base.ParseHTML, ReadOnly = this.ReadOnly, ShowFilterCriterias = base.ShowFilterCriterias, ShowHeader = this.ShowHeader, ShowHeaderCheckBox = this.ShowHeaderCheckBox, SortExpression = this.SortExpression, SortOrder = base.SortOrder, SortPriority = base.SortPriority, Visible = base.Visible, Width = base.Width, Wrap = base.Wrap, TemplateSettings = base.TemplateSettings.Clone() as ColumnTemplateSettings
             };
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        [Description("Gets or sets a value indicating the type of the control used by the column."), DefaultValue(2), Bindable(true), Category("Column Settings")]
        public GridControlType ControlType
        {
            get
            {
                object obj2 = base.ViewState["ControlType"];
                if (obj2 != null)
                {
                    return (GridControlType) obj2;
                }
                return GridControlType.Standard;
            }
            set
            {
                base.ViewState["ControlType"] = value;
            }
        }

        [DefaultValue(true), Description("Gets or sets a value indicating whether the checkbox for selecting / deselecting all records will be displayed in the header of the column."), Category("Column Settings"), Bindable(true)]
        public bool ShowHeaderCheckBox
        {
            get
            {
                object obj2 = base.ViewState["ShowHeaderCheckBox"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                base.ViewState["ShowHeaderCheckBox"] = value;
            }
        }
    }
}

